<?php
class Exam extends IController{
    public  function regis(){
        $this->redirect("regis");
    }
    public function act(){
        $id = $_GET['id'];
        $id = base64_decode($id);
        $arr = array('statue'=>1);
        $model = new IModel("b2");
        $model ->setData($arr);
        $res = $model->update("id=$id");
        if ($res) {
            $this->redirect("login");
        }

    }
    public function register(){
        $name = IReq::get("name");
        $pwd = IReq::get("pwd");
        $email = $_POST['email'];
        $arr = array('name'=>$name,'pwd'=>$pwd,'email'=>$email,'statue'=>0);
        $model =new IModel("b2");
        $model->setData($arr);
        $res = $model->add();
        if($res)
        {
            $title = "欢迎注册成为我们网站的会员";
            $url = "http://www.iwebshop.com/index.php/exam/act/id/".base64_encode($res);
            $content = "请点击此链接激活加入我们吧!".$url;
            $mail =new  SendMail();
            $mail->send($email,$title,$content);
        }
    }
    public function login_do()
    {
        $name = IReq::get("name");
        $pwd = IReq::get("pwd");
        $model = new IModel("b2");
        $res = $model->query("name='$name' and pwd='$pwd'");
        $status = $res[0]['statue'];
        if($status==1)
        {
            echo "登录成功";
        }else{
            echo "您未激活，请去邮箱激活";
        }
    }











}
?>